import re

def  check_input(str):
    is_valid = True
    if re.findall('\w',str):
        is_valid = False
    times_left_kuohao=str.count('(')  
    times_right_kuohao=str.count(')',0,len(str))
    if times_left_kuohao != times_right_kuohao :
        is_valid = False
    return is_valid



def format_input(str):
    str.replace(' ','')
    str.replace('++','+')
    str.replace('-+','-')
    str.replace('*+','*')
    str.replace('/+','/')
    str.replace('(+','(')
    return str

def calc_mul_dev(str):
    pass

def calc_add_sub(str):
    pass

def main():
    #str_input=input()
    str_input='(1+2*(3+(2+1)))'
    if check_input(str_input):
        str_formatted = format_input(str_input)
        print(str_formatted)
        while re.search('\(',str_formatted):
            str_in_kuohao = re.search('\([^()]+\)',str_formatted).group()
            print(str_in_kuohao)
            result_tmp1 = calc_mul_dev(str_in_kuohao)
            result_tmp2 = calc_add_sub(result_tmp1)
        else:
            result_tmp3 = calc_mul_dev(result_tmp2)
            result_tmp4 = calc_add_sub(result_tmp3)
    


main()